/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package utilidades;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 *
 * @author Alex
 */
public class Conexion {
    public Connection getConexion(String url, String usuario, String clave,String driver){
        Connection con = null;
        try{
            Class.forName(driver);
            con = DriverManager.getConnection(url, usuario, clave);
            
        }catch(SQLException ex){
        }catch(Exception e){
            e.printStackTrace();
        }
        return con;
    }
    
    public Connection getConexion(){
        Connection con = null;
        try{
            Class.forName("com.mysql.jdbc.Driver");
            con = DriverManager.getConnection("jdbc:mysql://localhost:3306/mydb", "root", "root");
//            con = DriverManager.getConnection("jdbc:mysql://localhost:3306/mydb", "root", "admin");
//            con = DriverManager.getConnection("jdbc:postgresql://localhost:5432/ces2", "ces2", "ces2");
            
        }catch(SQLException ex){
        }catch(Exception e){
            e.printStackTrace();
        }
        return con;
    }
    
}
